/**
 * Created by Administrator on 2017/5/26.
 */

// import * as utils from './utils'
// 进入系统的url
function getEntryUrl() {
  return window.sessionStorage.getItem('entryurl')
}

function setEntryUrl(value) {
  window.sessionStorage.setItem('entryurl', value)
}

function getMemberInfo() {
  return JSON.parse(window.localStorage.getItem('member'))
}
/**
 * 存储当前登录用户信息
 * @param {Object} member
 */
function setMemberInfo(member) {
  window.localStorage.setItem('member', JSON.stringify(member))
}

function delMemberInfo() {
  window.localStorage.removeItem('member')
}

function getKey() {
  // return utils.getCookie('key')
  return window.localStorage.getItem('key')
}

function setKey(value) {
  // utils.setCookie('key', value, 360)
  window.localStorage.setItem('key', value)
}

function delKey() {
  // utils.delCookie('key')
  window.localStorage.removeItem('key')
}

function getPwd() {
  return window.localStorage.getItem('pwd')
}

function setPwd(value) {
  window.localStorage.setItem('pwd', value)
}

function delPwd() {
  window.localStorage.removeItem('pwd')
}

function getAuthed() {
  let value = window.localStorage.getItem('authored')
  if (value == 'true') {
    return true
  }
  return false
}

function setAuthed(boolValue) {
  if (boolValue) {
    window.localStorage.setItem('authored', 'true')
  } else {
    window.localStorage.setItem('authored', 'false')
  }
}
// 获取是否欢迎过的标识
function getWelcomed() {
  let value = window.sessionStorage.getItem('welcomed')
  if (value == 'true') {
    return true
  }
  return false
}

function setWelcomed(boolValue) {
  if (boolValue) {
    window.sessionStorage.setItem('welcomed', 'true')
  } else {
    window.sessionStorage.setItem('welcomed', 'false')
  }
}
// 获取是否需要寄货
function getNeedGoods() {
  let value = window.sessionStorage.getItem('needgoods')
  if (value == 'true') {
    return true
  }
  return false
}

function setNeedGoods(boolValue) {
  if (boolValue) {
    window.sessionStorage.setItem('needgoods', 'true')
  } else {
    window.sessionStorage.setItem('needgoods', 'false')
  }
}

function getFkmid() {
  return window.sessionStorage.getItem('fkmid')
}

function setFkmid(value) {
  window.sessionStorage.setItem('fkmid', value)
}

function getIfReadedNotice20180316() {
  let value = window.sessionStorage.getItem('notice20180316')
  if (value == 'true') {
    return true
  }
  return false
}

function setIfReadedNotice20180316(boolValue) {
  if (boolValue) {
    window.sessionStorage.setItem('notice20180316', 'true')
  } else {
    window.sessionStorage.setItem('notice20180316', 'false')
  }
}

export {
  getEntryUrl,
  setEntryUrl,
  getMemberInfo,
  setMemberInfo,
  delMemberInfo,
  getKey,
  setKey,
  delKey,
  getPwd,
  setPwd,
  delPwd,
  getWelcomed,
  setWelcomed,
  getAuthed,
  setAuthed,
  getNeedGoods,
  setNeedGoods,
  getFkmid,
  setFkmid,
  getIfReadedNotice20180316,
  setIfReadedNotice20180316
}